/*
 * @Author: SimonCK666 SimonYang223@163.com
 * @Date: 2022-05-06 15:08:08
 * @LastEditors: SimonCK666 SimonYang223@163.com
 * @LastEditTime: 2022-05-06 16:40:08
 * @FilePath: \golang-concept\L2_goarray\slice.go
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package main

import "fmt"

func slice_basic() {
	// 数组是固定长度，slice 是拥有相同类型元素的可变长度序列
	var names = []string{"Simon", "Tom", "Kitty", "Go"}
	var s1 = make([]int, 2)
	fmt.Println("names", names)
	fmt.Println("s1: ", s1)
	fmt.Println("names", names[0:2]) // slice 的切片
	fmt.Println("names", names[:])   // [:] 取所有元素

	for _, v := range names {
		fmt.Printf("%v\t", v)
	}

}
